package com.jyh.config;


import java.lang.reflect.Method;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;

/**
 * bean自动扫描回调接口类<br>
 * xml中配置 <br>
 * < bean class="com.xsh.utils.processor"/ >
 * 
 * @author Administrator
 * 
 */
@Component
public class MyListenerProcessor implements BeanPostProcessor {

	public interface MyListenerProcessorBack {
		public void processorBack(Object bean, String beanName, Method method);
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (bean == null) {
			return bean;
		}
		Method[] methods = ReflectionUtils.getAllDeclaredMethods(bean.getClass());
		if (methods != null) {
			for (Method method : methods) {
				//spring启动扫描
			}
		}
		return bean;
	}
}
